import { get, post, put } from "@/utils/http";

// 获取空域类型
const getAirSpaceType = () => get("/airspace/getAirspaceType");

// 空域形状类型
const getAirSpaceShapeType = () => get("/airspace/getAirspaceShapeType");

// 添加方法 
const saveAirSpace = (data) => post("/airspace/add", data);

// 删除方法
const removeAirSpace = (id) => put(`/airspace/remove/${id}`);

// 获取区域范围内的数据
const getAirSpace = (region = 'NJLH') => get(`/airspace/getList?region=${region}`);

// 获取栅格类型
const getAriGridType = () => get(`/airspace/getGridType`)

// 获取不同层数栅格
const getAirGrid = (layer) => get(`/airspace/getGrid${layer ? `?layer=${layer}` : ''}`);

// 禁飞区网格
const getNoFlyGrid = () => get(`/airspace/getNoFlyGrid`)

// 栅格数据编辑
const updateAirGrid = (data) => put(`/airspace/updateGridInfo`, data);

// 获取航路
const getAirRoute = () => get(`/airspace/getRouteList`);

// 添加航路
const addAirRoute = (data) => post(`/airspace/addRoute`, data);

// 删除航路
const delAirRoute = (id) => put(`/airspace/delRoute/${id}`);

// 修改航路
const updateAirRoute = (data) => put(`/airspace/updateRouteInfo`,data);

export default {
  getAirSpaceType,
  saveAirSpace,
  removeAirSpace,
  getAirSpace,
  getAirSpaceShapeType,
  getAriGridType,
  getAirGrid,
  getNoFlyGrid,
  updateAirGrid,
  getAirRoute,
  addAirRoute,
  delAirRoute,
  updateAirRoute
};
